﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
namespace DAO
{
    public class MONHOCDAO
    {
        QUANLY_DIEMDataContext db = new QUANLY_DIEMDataContext();
        //load dach dach mon hoc
        public List<MONHOCDTO> LoadDanhSachMon()
        {
            List<MONHOCDTO> ds = new List<MONHOCDTO>();
            try
            {
                var dsmon = from p in db.MONHOCs
                            select p;
                foreach(var r in dsmon)
                {
                    MONHOCDTO mon = new MONHOCDTO();
                    mon.MAMH = r.MAMH;
                    mon.TENMH = r.TENMH;
                    ds.Add(mon);
                }
                return ds;
            }
            catch
            {
                return null;
            }
        }
    }
}
